package com.bqtv.sport.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter4.BaseQuickAdapter
import com.bqtv.sport.commen.widget.LinearItemDecoration
import com.bqtv.sport.databinding.ItemHomeHotBinding
import com.bqtv.sport.databinding.ItemHomeTodayBinding
import com.bqtv.sport.databinding.ItemMatchDetailBinding

class MatchDetailAdapter :
    BaseQuickAdapter<String, MatchDetailAdapter.VH>() {
    class VH(
        parent: ViewGroup,
        val binding: ItemMatchDetailBinding = ItemMatchDetailBinding.inflate(
            LayoutInflater.from(parent.context), parent, false
        ),
    ) : RecyclerView.ViewHolder(binding.root)

    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): VH {
        // 返回一个 ViewHolder
        return VH(parent)
    }

    override fun onBindViewHolder(holder: VH, position: Int, item: String?) {
        // 设置item数据
        holder.binding.rcvAuthor.layoutManager= LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
        holder.binding.rcvAuthor.addItemDecoration(
            LinearItemDecoration(
                context,
                LinearItemDecoration.LineDrawMode.HORIZONTAL,
                0f,
                15f,
                15f
            )
        )
        var authorAdapter= MatchDetailAuthorAdapter()
        holder.binding.rcvAuthor.adapter=authorAdapter
        authorAdapter.submitList(listOf("1","2","3"))
    }
}